﻿namespace GameStructure.Utilities
{
    public class FramesPerSecond
    {
        private int _numberOfFrames;
        private double _timePassed;

        public double CurrentFPS { get; private set; }

        public void Process(double timeElapsed)
        {
            _numberOfFrames++;
            _timePassed = _timePassed + timeElapsed;

            if (!(_timePassed > 1)) return;

            CurrentFPS = _numberOfFrames/_timePassed;
            _timePassed = 0;
            _numberOfFrames = 0;
        }
    }
}
